package zut.edu.cn.concertticketmanagementsystem.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import zut.edu.cn.concertticketmanagementsystem.entity.OrderDetail;
import zut.edu.cn.concertticketmanagementsystem.enums.OrderStatusEnum;
import zut.edu.cn.concertticketmanagementsystem.enums.PayStatusEnum;
import zut.edu.cn.concertticketmanagementsystem.serilizer.Date2LongSerializer;
import zut.edu.cn.concertticketmanagementsystem.utils.EnumUtil;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: heroma
 * Date: 6/22/19
 * Time: 4:37 PM
 * Description: No Description
 */
@Data
public class OrderDTO {
    //订单id
    private String orderId;
    //买家姓名
    private String buyerName;
    //买家手机号
    private String buyerPhone;
    //定金总额
    private BigDecimal orderAmount;
    //订单状态
    private Integer orderStatus;
    //支付状态
    private Integer payStatus;
    //创建时间
    @JsonSerialize(using= Date2LongSerializer.class)
    private Date createTime;
    //更新时间
    @JsonSerialize(using= Date2LongSerializer.class)
    private Date updateTime;
    List<OrderDetail> orderDetailList;
    @JsonIgnore
    public OrderStatusEnum getOrderStatusEnum(){
        return EnumUtil.getByCode(orderStatus, OrderStatusEnum.class);
    }
    @JsonIgnore
    public PayStatusEnum getPayStatusEnum(){
        return EnumUtil.getByCode(payStatus,PayStatusEnum.class);
    }
}
